<template>
  <div class="banner-item">
    <div v-if="navigator === 'mobile'">
      <div v-if="componentData.type === '1'" class="h5">
        <div v-if="componentData.pdfZh" class="header">
          <span>{{ componentData.titleZh }}</span>
          <div class="btn primary">立即获取报价</div>
          <div class="btn">下载PDF文档</div>
        </div>
        <div class="detail">
          <p class="ft-24">{{ componentData.titleZh }}</p>
          <p class="ft-16">{{ componentData.subtitleZh }}</p>
          <p class="ft-12">{{ componentData.descZh }}</p>
        </div>
        <img v-if="componentData.pcImgZh" :src="componentData.pcImgZh" alt="solution" />
      </div>
      <div v-if="componentData.type === '2'" class="col">
        <img
          v-for="(item, index) in h5ImgZh"
          :key="index"
          :src="item"
          class="col-img"
          alt="solution"
        />
      </div>
    </div>
    <template v-else>
      <div v-if="componentData.type === '1'" class="pc">
        <div v-if="componentData.pdfZh" class="header">
          <span>{{ componentData.titleZh }}</span>
          <div class="btn primary">立即获取报价</div>
          <div class="btn">下载PDF文档</div>
        </div>
        <div class="detail">
          <p class="ft-60">{{ componentData.titleZh }}</p>
          <p class="ft-32">{{ componentData.subtitleZh }}</p>
          <p class="ft-16">{{ componentData.descZh }}</p>
        </div>
        <img v-if="componentData.pcImgZh" :src="componentData.pcImgZh" alt="solution" />
      </div>
      <div v-if="componentData.type === '2'" class="col">
        <p>{{ componentData.titleZh }}</p>
        <img
          v-for="(item, index) in componentData.pcImgZh.split(',')"
          :key="index"
          :src="item"
          class="col-img"
          alt="solution"
        />
      </div>
    </template>
  </div>
</template>

<script>
export default {
  props: {
    componentData: {
      type: Object,
      default: () => ({}),
    },
    // 设备型号
    navigator: {
      type: String,
      default: '',
    },
  },
  data() {
    return {}
  },
  computed: {
    h5ImgZh() {
      let imgs = ''
      if (!this.componentData.h5ImgZh) {
        imgs = this.componentData.pcImgZh
      }
      return imgs.split(',')
    },
  },
  methods: {},
}
</script>

<style lang="less" scoped>
@import '~assets/var';

.banner-item {
  .h5 {
    position: relative;
    background-color: #fff;
    height: 450px;
    text-align: center;
    padding: 60px 0 0;
    overflow: hidden;

    img {
      max-width: 340px;
      max-height: 340px;
      display: block;
      margin: 0 auto;
    }

    .ft-24 {
      font-size: 24px;
      color: #0762cb;
      font-weight: bold;
    }

    .ft-16 {
      font-size: 16px;
      line-height: 28px;
      color: #444;
      font-weight: bold;
    }

    .ft-12 {
      font-size: 12px;
      color: #666;
      font-weight: 400;
    }

    .header {
      width: 375px;
      height: 48px;
      padding: 0 24px;
      position: fixed;
      top: 124px;
      z-index: 20;
      background: #fff;
      border-radius: 4px;
      border-bottom: 1px solid #f6f4f4;

      span {
        font-size: 14px;
        line-height: 48px;
        color: #333;
        font-weight: 500;
        float: left;
      }

      .btn {
        font-size: 10px;
        height: 28px;
        line-height: 26px;
        padding: 0 10px;
        margin: 10px 0 0 10px;
        color: #0261bc;
        border: 1px solid #0261bc;
        border-radius: 20px;
        float: right;
        cursor: pointer;

        &.primary {
          background-color: #0261bc;
          color: #fff;
        }
      }
    }
  }

  .pc {
    background-color: #fff;
    border: 1px dashed #e0e4ec;
    position: relative;
    overflow: hidden;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    .height(900);

    .detail {
      .mg(-40, -80, 0, 0);

      background-color: #fff;
      position: relative;

      .ft-60 {
        .ft(60);
        .lineH(100);

        color: #0762cb;
        font-weight: bold;
      }

      .ft-32 {
        .ft(32);
        .lineH(60);

        color: #444;
        font-weight: bold;
      }

      .ft-16 {
        .ft(16);
        .lineH(32);

        color: #666;
        font-weight: 400;
      }
    }

    img {
      .maxWidth(860);
      .maxHeight(860);
    }

    .col-img {
      width: 100%;
      height: auto;
      display: block;
    }

    .header {
      .width(1900);
      .height(72);
      .pd(0, 360, 0, 360);

      position: fixed;
      top: 110px;
      z-index: 20;
      background: #fff;
      border-bottom: 1px solid #f6f4f4;

      span {
        .ft(18);
        .lineH(72);

        color: #333;
        font-weight: 500;
      }

      .btn {
        .height(38);
        .ft(18);
        .lineH(36);
        .pd(0, 18, 0, 18);
        .mg(17, 0, 0, 20);
        .border(20);

        color: #0261bc;
        border: 1px solid #0261bc;
        float: right;
        cursor: pointer;

        &.primary {
          background-color: #0261bc;
          color: #fff;
        }
      }
    }
  }

  .col {
    background-color: #fff;
    border: 1px dashed #e0e4ec;
    position: relative;
    overflow: hidden;
    min-height: 100px;

    .col-img {
      width: 100%;
      height: auto;
      display: block;
    }
  }
}
</style>
